
CREATE  SEQUENCE  ADDRESS_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER ADDRESS_TRIGGER
BEFORE INSERT ON ADDRESS
FOR EACH ROW 
WHEN (NEW.A_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT ADDRESS_SEQ.NEXTVAL INTO:NEW.A_ID FROM DUAL;
END;

----------------------------------------------------------------------

CREATE  SEQUENCE  CATEGORY_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER CATEGORY_TRIGGER
BEFORE INSERT ON CATEGORY
FOR EACH ROW 
WHEN (NEW.C_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT CATEGORY_SEQ.NEXTVAL INTO:NEW.C_ID FROM DUAL;
END;

----------------------------------------------------------------------

CREATE  SEQUENCE  COMMENTS_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER COMMENTS_TRIGGER
BEFORE INSERT ON COMMENTS
FOR EACH ROW 
WHEN (NEW.ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT COMMENTS_SEQ.NEXTVAL INTO:NEW.ID FROM DUAL;
END;

----------------------------------------------------------------------

CREATE  SEQUENCE  DELIVERY_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER DELIVERY_TRIGGER
BEFORE INSERT ON DELIVERY
FOR EACH ROW 
WHEN (NEW.D_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT DELIVERY_SEQ.NEXTVAL INTO:NEW.D_ID FROM DUAL;
END;


----------------------------------------------------------------------

CREATE  SEQUENCE  GET_STAR_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER GET_STAR_TRIGGER
BEFORE INSERT ON GET_STAR
FOR EACH ROW 
WHEN (NEW.ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT GET_STAR_SEQ.NEXTVAL INTO:NEW.ID FROM DUAL;
END;




----------------------------------------------------------------------

CREATE  SEQUENCE  GOOD_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER GOOD_TRIGGER
BEFORE INSERT ON GOOD
FOR EACH ROW 
WHEN (NEW.G_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT GOOD_SEQ.NEXTVAL INTO:NEW.G_ID FROM DUAL;
END;


----------------------------------------------------------------------

CREATE  SEQUENCE  ORDER_GOOD_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER ORDER_GOOD_TRIGGER
BEFORE INSERT ON ORDER_GOOD
FOR EACH ROW 
WHEN (NEW.ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT ORDER_GOOD_SEQ.NEXTVAL INTO:NEW.ID FROM DUAL;
END;



----------------------------------------------------------------------

CREATE  SEQUENCE  RIDER_ORDER_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER RIDER_ORDER_TRIGGER
BEFORE INSERT ON RIDER_ORDER
FOR EACH ROW 
WHEN (NEW.R_O_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT RIDER_ORDER_SEQ.NEXTVAL INTO:NEW.R_O_ID FROM DUAL;
END;


----------------------------------------------------------------------

CREATE  SEQUENCE  ROLE_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER ROLE_TRIGGER
BEFORE INSERT ON ROLE
FOR EACH ROW 
WHEN (NEW.R_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT ROLE_SEQ.NEXTVAL INTO:NEW.R_ID FROM DUAL;
END;


----------------------------------------------------------------------

CREATE  SEQUENCE  SHOP_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER SHOP_TRIGGER
BEFORE INSERT ON SHOP
FOR EACH ROW 
WHEN (NEW.S_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT SHOP_SEQ.NEXTVAL INTO:NEW.S_ID FROM DUAL;
END;


----------------------------------------------------------------------

CREATE  SEQUENCE  SHOP_MANAGER_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER SHOP_MANAGER_TRIGGER
BEFORE INSERT ON SHOP_MANAGER
FOR EACH ROW 
WHEN (NEW.S_M_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT SHOP_MANAGER_SEQ.NEXTVAL INTO:NEW.S_M_ID FROM DUAL;
END;


----------------------------------------------------------------------

CREATE  SEQUENCE  T_ORDER_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER T_ORDER_TRIGGER
BEFORE INSERT ON T_ORDER
FOR EACH ROW 
WHEN (NEW.O_ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT T_ORDER_SEQ.NEXTVAL INTO:NEW.O_ID FROM DUAL;
END;

----------------------------------------------------------------------

CREATE  SEQUENCE  T_USER_SEQ 
             increment by 1    -- 每次递增1  
             start with 100       -- 从1开始  
             nomaxvalue      -- 没有最大值  
             minvalue 1;       -- 最小值=1  


--格式：
CREATE OR REPLACE TRIGGER T_USER_TRIGGER
BEFORE INSERT ON T_USER
FOR EACH ROW 
WHEN (NEW.ID IS NULL) --主键不存在才调用触发器
BEGIN
  SELECT T_USER_SEQ.NEXTVAL INTO:NEW.ID FROM DUAL;
END;